class Solution(object):
    def maxSubsequence(self, nums, k):
        n = len(nums)
        nums = [[num, index] for index, num in enumerate(nums)]
        nums.sort(reverse=True)
        nums = nums[:k]
        nums.sort(key=lambda x: x[1])
        out = [num[0] for num in nums]
        return out